fix: allow caret placement inside commented text on click (SD-2442)#2708
Conversation
caio-pizzol
left a comment
There was a problem hiding this comment.
@luccas-harbour fix looks good, no bugs found. clicking on commented text places the caret correctly and the right comment gets selected — tested all the cases (single comment, overlapping comments, re-clicking same comment).
one side effect: clicking commented text highlights the comment bubble but doesn't open the reply thread like google docs does. filed SD-2460 for that — not a blocker here.
left one small inline comment on the test helpers.
Pointer capture (used by PresentationEditor during pointerdown) redirects the click event target to the viewport host. The v-click-outside directive fires on the click event, so e.target no longer matches the original comment highlight span. This caused handleClickOutside to clear the active comment immediately after selection-based activation set it. Use document.elementFromPoint as a fallback to check what's actually under the cursor coordinates, so the ignored-selectors check works regardless of pointer capture.
Unit tests: - elementFromPoint fallback when e.target is wrong (pointer capture) - elementFromPoint fallback for tracked-change selectors - inverse: elementFromPoint returns non-ignored element, bubble dismissed Behavior tests: - clicking inside commented text activates the comment bubble - double-clicking inside commented text selects a word
|
🎉 This PR is included in vscode-ext v1.1.0-next.75 |
|
🎉 This PR is included in @superdoc-dev/react v1.0.0-next.29 The release is available on GitHub release |
|
🎉 This PR is included in esign v2.2.0-next.33 The release is available on GitHub release |
|
🎉 This PR is included in template-builder v1.3.0-next.35 The release is available on GitHub release |
caio-pizzol
left a comment
There was a problem hiding this comment.
@luccas-harbour fix works well — clicking inside commented text places the cursor correctly now.
found one extra issue while testing: after clicking commented text, the comment bubble would flash active then immediately deselect. the click-outside handler on the comment dialog wasn't recognizing the click landed on a comment highlight (because of how the editor captures mouse events). fixed in 8bf0625.
also cleaned up the test helper math from round 1 (d5ae180) and added tests for everything — cursor placement, bubble staying active, and word selection via double-click.
|
🎉 This PR is included in superdoc v1.24.0-next.72 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-cli v0.5.0-next.73 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-sdk v1.3.0-next.74 |
|
🎉 This PR is included in superdoc-sdk v1.4.0 |
|
🎉 This PR is included in superdoc v1.25.0 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-cli v0.6.0 The release is available on GitHub release |
|
🎉 This PR is included in vscode-ext v2.3.0-next.1 |
|
🎉 This PR is included in template-builder v1.5.0-next.1 The release is available on GitHub release |
|
🎉 This PR is included in esign v2.3.0-next.1 The release is available on GitHub release |
Summary
sd-2442-commented-text-caret.spec.ts) and updates existing unit tests to reflect the new behavior